class Solution
{
public:
    int minMoves(vector<int> &nums)
    {
        int minNum = INT_MAX;
        long long sum = 0;
        for (int num : nums)
        {
            sum += num;
            minNum = min(minNum, num);
        }
        long long result = sum - minNum * nums.size();
        return result;
    }
};